package user.controller;

import common.model.Consultation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import user.Service.ConsultationService;

import java.util.List;

@RestController
@RequestMapping("/user/consult")
public class ConsultationController {

    @Autowired
    private ConsultationService consultationService;

    @PostMapping
    public ResponseEntity<Void> consultLawyer(@RequestBody Consultation consultation) {
        consultationService.consultLawyer(consultation);
        return ResponseEntity.noContent().build();
    }

    @GetMapping("/consultations")
    public ResponseEntity<List<Consultation>> getUserConsultations(@RequestParam Long userId) {
        return ResponseEntity.ok(consultationService.getUserConsultations(userId));
    }
}